The present invention relates to a voltage detection circuit and a method for controlling the same.
A microcontroller usually has a voltage detection circuit for detecting a voltage drop in order to avoid a malfunction caused by a power supply voltage drop in a system like a mobile apparatus using a battery.
FIG. 19 shows a low voltage detector 1 generally carried on the microcontroller. As shown in FIG. 19, the low voltage detector 1 has a comparison voltage generation circuit 2, a comparator 3, a reference voltage generation circuit 4, and a latch circuit 5.
The comparison voltage generation circuit 2 has a ladder resistor 6 and a voltage selection circuit 7. The ladder resistor 6 has multiple resistors coupled in series between a power supply terminal and a grounding terminal. At nodes among these resistors, multiple voltages obtained by dividing with the resistors can be generated. The voltage selection circuit 7 selects and outputs one of the voltages that the ladder resistor 6 generates. The voltage that the voltage selection circuit 7 selected is designated by a comparison voltage.
The comparator 3 compares a voltage that the reference voltage generation circuit 4 generated and the comparison voltage. Then, the comparator 3 outputs a comparison result as a detection signal. The latch circuit 5 latches the detection signal from the comparator 3 according to a clock, and outputs it as a reset signal or interrupt signal.
The low voltage detector 1 like this detects that the power supply voltage lowers less than a predetermined voltage value. Then, it is capable of preventing the malfunction of a microcontroller that adopts this low voltage detector 1 by outputting the interrupt signal or reset signal. Incidentally, whether the signal to be outputted is the reset signal or interrupt signal is determined according to a configuration of the microcontroller that adopts this low voltage detector 1.
Here, in respect of its capability, the number of sensors that the apparatus has on it, such as a touch sensor and an acceleration sensor, is increasing in recent years. Thus, since multiple sensors are coupled to the microcontroller, multiple comparators for comparing multiple voltages have become necessary. However, the low voltage detector 1 described above can detect only an internal voltage drop of the microcontroller. Therefore, it is incapable of detecting a voltage drop of an external input voltage, such as a sensor output that the microcomputer inputs therein from the outside.
As a system for detecting the voltage drop of the external input voltage inputted from the outside in this way, there is a microcontroller as described in R8C/35A Group Hardware Manual, Renesas Microcomputer R8C Family/R8C/3x Series, pp. 73 to 90. FIG. 20 shows a block configuration diagram of a low voltage detection circuit 10 described in R8C/35A Group Hardware Manual, Renesas Microcomputer R8C Family/R8C/3x Series, pp. 73 to 90.
As shown in FIG. 20, the low voltage detection circuit 10 has a ladder resistor 11, a switch circuit 12, level selection circuits 13, 14, comparators 15 to 17, an external voltage input terminal 18, a power supply terminal 19, registers REG11 to REG13, and OR circuits OR11 to OR13.
The low voltage detection circuit 10 can compare multiple voltages generated by the ladder resistor and an internal reference voltage. For example, the level selection circuits 13, 14 each select one of the voltages generated by the ladder resistor, and output it to the comparators 16, 17, respectively. The comparators 16, 17 each compare the voltage that these level selection circuits 13, 14 selected and the internal reference voltage, and output the comparison result as voltage detection signals S2, S3, respectively. Incidentally, the value of the voltage detection signal S2 is stored in the register REG13.
On the other hand, the switch circuit 12 selects either the voltage generated by the ladder resistor or the external voltage inputted from the external voltage input terminal 18 and inputs it into a non-inverting input terminal of the comparator 15. That selection is decided depending on a value that a register REG11 retains. That is, the comparator 15 compares either the voltage generated by the ladder resistor or the external input voltage inputted from the external voltage input terminal 18 with the internal reference voltage depending on the value that the register REG11 retains. The comparison result is outputted as a voltage detection signal S1. Incidentally, the value of the voltage detection signal S1 is stored in a register REG12.
Thus, the low voltage detection circuit 10 can switch either the external input voltage or the voltage generated from a power supply voltage as a comparison object of the reference voltage with the switch circuit 12. This enables detection of the drop of the external input voltage other than the power supply voltage that cannot be done by the low voltage detector 1.